package com.ruoyi.basicData.warehouse.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.sync.BaseService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.basicData.warehouse.mapper.WarehouseMapper;
import com.ruoyi.basicData.warehouse.domain.Warehouse;
import com.ruoyi.basicData.warehouse.service.IWarehouseService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 仓库管理Service业务层处理
 * 
 * @author YiYuan
 * @date 2024-01-27
 */
@Service
public class WarehouseServiceImpl extends BaseService implements IWarehouseService
{
    @Autowired
    private WarehouseMapper warehouseMapper;

    /**
     * 查询仓库管理
     * 
     * @param warehouseId 仓库管理主键
     * @return 仓库管理
     */
    @Override
    public Warehouse selectWarehouseByWarehouseId(String warehouseId)
    {
        return warehouseMapper.selectWarehouseByWarehouseId(warehouseId);
    }

    /**
     * 查询仓库管理列表
     * 
     * @param warehouse 仓库管理
     * @return 仓库管理
     */
    @Override
    public List<Warehouse> selectWarehouseList(Warehouse warehouse)
    {
        return warehouseMapper.selectWarehouseList(warehouse);
    }

    /**
     * 新增仓库管理
     * 
     * @param warehouse 仓库管理
     * @return 结果
     */
    @Override
    public int insertWarehouse(Warehouse warehouse)
    {
        warehouse.setWarehouseId(IdUtils.fastUUID());
        warehouse.setCreateTime(DateUtils.getNowDate());
        return warehouseMapper.insertWarehouse(warehouse);
    }

    /**
     * 修改仓库管理
     * 
     * @param warehouse 仓库管理
     * @return 结果
     */
    @Override
    public int updateWarehouse(Warehouse warehouse)
    {
        warehouse.setUpdateTime(DateUtils.getNowDate());
        return warehouseMapper.updateWarehouse(warehouse);
    }

    /**
     * 批量删除仓库管理
     * 
     * @param warehouseIds 需要删除的仓库管理主键
     * @return 结果
     */
    @Override
    public int deleteWarehouseByWarehouseIds(String[] warehouseIds)
    {
        return warehouseMapper.deleteWarehouseByWarehouseIds(warehouseIds);
    }

    /**
     * 删除仓库管理信息
     * 
     * @param warehouseId 仓库管理主键
     * @return 结果
     */
    @Override
    public int deleteWarehouseByWarehouseId(String warehouseId)
    {
        return warehouseMapper.deleteWarehouseByWarehouseId(warehouseId);
    }

    @Override
    @Transactional
    public int updateDelFlagByIds(String[] warehouseIds) {
        return warehouseMapper.updateDelFlagByIds(warehouseIds);
    }

    @Override
    public List<Warehouse> getWareHouseSearchList(String keyWord) {
        return warehouseMapper.getWareHouseSearchList(keyWord);
    }
}
